// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App.vue'
// 路由
import router from './router/index.ts'
// 自定义api
import api from './api/index.ts'
// font
import fontawesome from '@fortawesome/fontawesome'
import FontAwesomeIcon from '@fortawesome/vue-fontawesome'
import solid from '@fortawesome/fontawesome-free-solid'
import regular from '@fortawesome/fontawesome-free-regular'
import brands from '@fortawesome/fontawesome-free-brands'
// promise
import "babel-polyfill"
// element ui
import Element from 'element-ui'
import './assets/scss/element-variables.scss'
// 代码高亮
import hljs from 'highlight.js'
import 'highlight.js/styles/dracula.css'
// 编辑器
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
// vuex
import store from './store/index.ts'

import VueParticles from 'vue-particles'

Vue.use(VueParticles)

Vue.use(mavonEditor)
Vue.directive('highlight', function (el) {
  let blocks = el.querySelectorAll('pre code');

  (blocks as any).forEach((block) => {
    hljs.highlightBlock(block)
  })
})

// icon
fontawesome.library.add(solid)
fontawesome.library.add(regular)
fontawesome.library.add(brands)
Vue.component('font-awesome-icon', FontAwesomeIcon)
// api
Vue.use(api)

// ui
Vue.use(Element)

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: (el) => el(App)
})
